package com.jinlia.show.modules.base.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jinlia.show.modules.base.system.entity.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("SELECT t3.* from sys_user_role t1 " +
            "left join sys_user t2 ON t1.user_id = t2.id " +
            "LEFT join sys_role t3 on t3.id = t1.role_id " +
            "where t1.user_id =#{userId}")
    List<SysRole> getByUserId(@Param("userId") Long userId);
}
